/*
 * @Author: wangyongcun
 * @Date: 2023-09-06 15:51:24
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2024-05-01 09:14:38
 * @Description: 全局打印
 */
import * as log4js from "log4js";
const { configure, getLogger } = log4js.default;
configure({
  appenders: {
    console: {
      type: "console",
    },
    file: {
      type: "file",
      filename: "./logs/log.log",
      compress: false, // 启动日志压缩
      backups: 5, // 仅保留最新的五个日志文件
      pattern: ".yyyy-MM-dd", // 用于确定何时滚动日志的模式
      maxLogSize: 104800, // 10mb,日志文件大小,超过该size则自动创建新的日志文件
    },
  },
  categories: {
    default: { appenders: ["console", "file"], level: "all" },
  },
});
global.log = getLogger();
